package com.eleven.mall.controller;


import com.eleven.mall.pojo.OrderPage;
import com.eleven.mall.pojo.Rbody;
import com.eleven.mall.service.OrderService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@Component
@RestController
@AllArgsConstructor
@CrossOrigin
public class OrderController {
    OrderService orderService;

//    订单列表
    @GetMapping("/orders")
    public Rbody getOrderList(String query, String pagenum, Integer pagesize){
        System.out.println("==========查询参数:"+query+" pagenum:"+pagenum+" pagesize:"+pagesize);
        Rbody rbody = new Rbody();
        OrderPage orderPage = orderService.getOrderList(query, pagenum, pagesize);
        rbody.setData(orderPage);
        rbody.getMeta().setMsg("获取成功");
        return rbody;
    }
}
